package com.zw.cc.base;

/**
 * Created by zwz
 * 2016/8/20.
 * common.controller
 */

public class BaseResult<T>{

    public int statusCode;

    public String statusMessage;

    public T data;

    private static final String PREFIX = "result.code.";

    public BaseResult() {
        this.statusCode = ExceVariables.SUCCESS;
        this.statusMessage = SpringContextUtils.getProperty(PREFIX +ExceVariables.SUCCESS);
    }

    public BaseResult(int statusCode) {
        this.statusCode = statusCode;
        this.statusMessage = SpringContextUtils.getProperty(PREFIX +statusCode);
    }

    public BaseResult(int statusCode, String statusMessage) {
        this.statusCode = statusCode;
        this.statusMessage = statusMessage;
    }

    public BaseResult(T data) {
        this.statusCode = ExceVariables.SUCCESS;
        this.statusMessage = SpringContextUtils.getProperty(PREFIX +ExceVariables.SUCCESS);
        this.data = data;
    }
    public BaseResult(int statusCode, T data) {
        this.statusCode = statusCode;
        this.statusMessage = SpringContextUtils.getProperty(PREFIX +statusCode);
        this.data = data;
    }
    public BaseResult(int statusCode, String statusMessage, T data) {
        this.statusCode = statusCode;
        this.statusMessage = statusMessage;
        this.data = data;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getStatusMessage() {
        return statusMessage;
    }

    public void setStatusMessage(String statusMessage) {
        this.statusMessage = statusMessage;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
